module.exports = {

    setDataAgain: {
        "costprofits": (data) => {
            /**
             *
             */
            if (!data?.length) return []
            const newData = []
            for (let item of data) {
                const obj = item?.auxiliaryMaterialsConsumptionInfo || {}
                if (!Object.keys(obj)?.length) {
                    newData.push({...item})
                    continue;
                };
                for (let key in obj) {
                    item[`cost_${key}`] = obj[key]?.cost || ''

                    item[`name_${key}`] = obj[key]?.inventoryName || ''

                }
                newData.push({...item})
            }
            return newData
        }
    }

}